using System;
using System.Runtime.Serialization.Formatters.Binary ;
using System.IO;
using System.Diagnostics;
using AppliedRecognition.Util;
namespace AppliedRecognition.Speech.TaskSupport {

	/// <summary>
	/// Obtains list of tasks which are visible in task list
	/// </summary>
	[Serializable]
	public class ModalWindows: EnumWindows {
		
		private ARTraceSwitch CommandTS= new ARTraceSwitch("Command", "Actions");

		private IntPtr ownerWindow;
		public ModalWindows(IntPtr hwndOwnerWindow) 
		{
			ownerWindow= hwndOwnerWindow;
		}

		protected override  bool OnWindowEnum(IntPtr hWnd) 
		{
			WindowItem w = new WindowItem(hWnd,GetOwnerWindow(hWnd));

			if (w.OwnerHandle != ownerWindow || w.Handle == ownerWindow)
				return true;
			if ( w.Visible ) { //&& w.IsTopMost
				base.Items.Add(w);
			}

			return true;
		}

	} //end class

}
